package com.hxkj.dao.impl;

import com.hxkj.dao.ChannelDao;
import com.hxkj.domain.po.Channel;
import com.hxkj.mapper.ChannelMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
* 数据操作实现
*
* @author: chenwei
* @version: 1.0
* @datetime: 2018-06-05 19:32:55
*
*/
@Service("channelDao")
public class ChannelDaoImpl implements ChannelDao {

    @Resource
    private ChannelMapper channelMapper;

    @Override
    public int saveChannel(Channel channel) {
        channel.setCreateTime(System.currentTimeMillis());
        channel.setUpdateTime(System.currentTimeMillis());
        return channelMapper.saveChannel(channel);
    }

    @Override
    public List<Channel> getChannelList(Channel channel) {
        return channelMapper.getChannelList(channel);
    }

    @Override
    public int modifyChannel(Channel channel) {
        channel.setUpdateTime(System.currentTimeMillis());
        return channelMapper.modifyChannel(channel);
    }

    @Override
    public List<Channel> getChannelByName(String channelName,Long siteId) {
        Channel channel = new Channel();
        channel.setChannelName(channelName);
        channel.setSiteId(siteId);
        return channelMapper.getChannelByName(channel);
    }

    @Override
    public int removeChannelById(Long channelId) {
        return channelMapper.removeChannelById(channelId);
    }

    @Override
    public Channel getChannelById(Long channelId) {
        return channelMapper.getChannelById(channelId);
    }

    @Override
    public List<Channel> getListBySiteId(Channel channel) {
        return channelMapper.getListBySiteId(channel);
    }

    @Override
    public List<Channel> getChannelByTempletId(Channel channel) {
        return channelMapper.getChannelByTempletId(channel);
    }

    @Override
    public List<Channel> getChannelByTempletName(String templetName, Long siteId) {
        Channel channel = new Channel();
        channel.setTempletName(templetName);
        channel.setSiteId(siteId);
        return channelMapper.getChannelByTempletName(channel);
    }
}
